
#include "Probability.h"

Probability::Probability(double prob) throw (int) : probability(prob)
{
    if (probability < 0.0 || probability > 1.0)
    {
        throw OUT_OF_RANGE_OF_PROBABILITY;
    }
}

Probability Probability::operator&(const Probability& prob) const
{
    return this->probability * prob.probability;
}

Probability Probability::operator|(const Probability& prob) const
{
    return this->probability + prob.probability - this->probability * prob.probability;
}

Probability Probability::operator!(void) const
{
    return 1.0 - this->probability;
}

bool Probability::operator==(const Probability& prob) const
{
    return this->probability == prob.probability;
}

bool Probability::operator!=(const Probability& prob) const
{
    return this->probability != prob.probability;
}

